/*
** char_to_int.c for adas in /home/phand/exotest/tek2/prog-elem/trade/trade-42
** 
** Made by david phan
** Login   <phan_d@epitech.net>
** 
** Started on  Fri Jun  1 18:17:10 2012 david phan
** Last update Fri Jun  1 19:31:53 2012 david phan
*/

#include <stdlib.h>
#include <unistd.h>

#include "h_trade.h"

char		*int_to_char(int nb)
{
  char		*str;
  int		puissance;
  int		tmp;
  int		i;

  i = 0;
  str = malloc(500);
  puissance = 1;
  while (nb / puissance >= 10)
    puissance = puissance * 10;
  while (puissance > 0)
    {
      tmp = nb / puissance;
      str[i] = (tmp % 10 + '0');
      puissance = puissance / 10;
      i++;
    }
  str[i+1] = '\n';
  return (str);
}
